<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/dndTemplate.xhtml">


	<ui:define name="login">
	<h:form rendered="#{!myCardsBean.loggedIn}">
		<h:outputText value="#{myCardsBean.output}" id="loginOut" />
		Name:<p:inputText value="#{myCardsBean.userName}"/>	
		Password:<p:password value="#{myCardsBean.password}"/>
		<p:commandButton value="Login" actionListener="#{myCardsBean.loginUser()}" update="@all"/>
		<p:commandButton value="Register" action="#{myCardsBean.registerUser()}" update="loginOut"/>
	</h:form>
	<h:form rendered="#{myCardsBean.loggedIn}">
		<h:outputText value="#{myCardsBean.output}" />
		Logged in as user:<p:outputLabel value="#{myCardsBean.userName}"/>	
		<p:commandButton value="Logout" action="#{myCardsBean.logoutUser()}" update="@all"/>
	</h:form>
	</ui:define>
	<ui:define name="menu">
		<p:tabMenu activeIndex="0" >
			<p:menuitem value="Home" url="/index.xhtml" icon="ui-icon-home" />
			<p:menuitem value="Game" url="/web/game.xhtml" icon="ui-icon-star" />
			<p:menuitem value="Cards" url="/web/cards.xhtml"
				icon="ui-icon-folder-collapsed" />
			<p:menuitem value="MyCards" url="/web/mycards.xhtml"
				icon="ui-icon-wrench"  disabled="#{!myCardsBean.loggedIn}" />
			<p:menuitem value="AdminCards" url="/web/admincards.xhtml"
				icon="ui-icon-wrench"  rendered="#{myCardsBean.userIsAdmin}" />
			<p:menuitem value="AdminPage" url="/web/adminpage.xhtml"
				icon="ui-icon-wrench"  rendered="#{myCardsBean.userIsAdmin}" />
		</p:tabMenu>
	</ui:define>

</ui:composition>

</html>
